home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / chunky.lha / lib_chunky / tst-src / test4.c < prev    next >
C/C++ Source or Header  |  1998-02-27  |  1KB  |  50 lines

  1. #include  <intuition/intuition.h>
  2. #include  <dos/dos.h>
  3. #include  <proto/intuition.h>
  4. #include  <proto/graphics.h>
  5. #include  "../lib-src/chunky.h"
  6.  
  7. int main( void )
  8. {
  9.     struct ChunkyPort *cp;
  10.     struct RastPort   *rp;
  11.     struct Window     *win;
  12.     struct TextFont   *tf;
  13.     struct TextAttr   ta = {"topaz.font", 8, 0, 0};
  14.  
  15.     if(win = OpenWindowTags( NULL, WA_InnerWidth, 320,
  16.                                                                  WA_InnerHeight, 200,
  17.                                                                  WA_AutoAdjust, TRUE,
  18.                                                                  TAG_DONE ) )
  19.     {
  20.         rp = win->RPort;
  21.         if( cp = InitChunkyPort(  win->Width-win->BorderLeft-win->BorderRight,
  22.                                                             win->Height-win->BorderTop-win->BorderBottom ) )
  23.         {
  24.             if( tf = OpenFont( &ta ) )
  25.             {
  26.                 char  *txt1 = "This is a fixed-width-font test chk";
  27.                 char  *txt2 = "This is a fixed-width-font test rpt";
  28.                 SetFont( rp, tf );
  29.                 SetAPen( rp, 1 );
  30.                 SetFontChk( cp, tf );
  31.                 SetSoftStyleChk( cp, FSF_EMBOSSED );
  32.                 SetABOPenChk( cp, 1, 4, 5 );
  33.                 MoveChk( cp, 4, 40 );
  34.                 TextChk( cp, txt1 );
  35.                 DrawChunkyPort( cp, rp, win->LeftEdge+win->BorderLeft, win->TopEdge+win->BorderTop );
  36.                 Move(rp, win->BorderLeft+4, 60 );
  37.                 Text( rp, txt2, strlen(txt2));
  38.                 printf("TextLength()   : %ld\n"
  39.                              "TextLengthChk(): %ld\n",
  40.                              TextLength(rp, txt2, strlen(txt2 ) ),
  41.                              TextLengthChk( cp, txt1, strlen(txt1 ) ) );
  42.                 Wait( SIGBREAKF_CTRL_C );
  43.                 CloseFont( tf );
  44.             }
  45.             FreeChunkyPort( cp );
  46.         }
  47.         CloseWindow( win );
  48.     }
  49. }
  50.